<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="layout">
<head>
<title>游戏列表</title>
<style type="text/css">
.bs-docs-example {
	position: relative;
	margin: 10px 0;
	padding: 10px 10px 10px;
	background-color: #fff;
	border: 1px solid #ddd;
	-webkit-border-radius: 4px;
	-moz-border-radius: 4px;
	border-radius: 4px;
}
</style>
<script type="text/javascript" th:src="@{/js/pagination.js}"></script>
<script type="text/javascript">
	$(document).ready(function() {
	});
	function doQuery(flag) {
		// flag==false 表示是第一次查询,将pageNum设置为1
		var pageNum = flag ? pagination.getPageNum() : 1;
		$("#pageNum").val(pageNum);
		$("#pageSize").val(pagination.getPageSize());
		$("#searchForm").submit();
	}
</script>
</head>
<body>
	<div layout:fragment="content">
		<!-- 搜索区 -->

		<div class="row">
			<div class="col-lg-10">
				<form id="searchForm" th:action="@{/game}" class="bs-docs-example form-search" method="post">
					<div class="input-append ">
						<label>游戏标识:</label>
						 <input type="text" name="id" th:value="${searchCondition.model.id}" class="span2"> 
						<label>游戏名称:</label>
						<input type="text" name="name" th:value="${searchCondition.model.name}" class="span2">
						 <a
							class="btn btn-success" href="#" style="margin-left: 20px;"
							role="button" onclick="javascript:doQuery();">查询 </a>
					</div>
					<!-- add query condition at next row 
					  <div class="input-prepend">
					  	<input type="text" class="span2 search-query">
					  </div>
				  -->
					<!--  using to pagination -->
					<input type="hidden" id="pageSize" name="pagSize" /> 
					<input type="hidden" id="pageNum" name="pageNum" />
				</form>
			</div>
			<div class="col-lg-2">
				<a class="btn btn-success" th:href="@{/game(form)}" style="margin-top: 20px;"
					role="button">新增</a>
			</div>
		</div>

		<!-- 数据区 -->
		<div class="row">
			<div class="col-lg-12">
				<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>游戏ID</th>
								<th>游戏名称</th>
								<th>游戏平台</th>
								<th>游戏类型</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<tr th:each="game : ${page.items}">
								<td th:text="${game.id}" />
								<td th:text="${game.name}" />
								<td th:text="${game.gamePlat}" />
								<td th:text="${game.gameType}" />
								<td>
									<a th:href="@{'/game/' + ${game.id}}">查看</a>
									
									<a th:href="@{'/game/update/' + ${game.id}}">修改</a>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<!-- /.table-responsive -->
			</div>
		</div>
		<div th:include="pagenav :: pagination"></div>
	</div>
</body>
</html>
